package com.cn.kabalifeuser.ui.my.adapter;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;

import java.util.List;

/**
 * Created by 晓林 on 2020/9/7.
 * function:
 */
public class PagerAdapter extends FragmentStatePagerAdapter {

    private List<String> mList;
    private List<Fragment> mFragments;

    public PagerAdapter(FragmentManager fm, List<String> mList, List<Fragment> fragmentList) {
        super(fm);
        this.mList = mList;
        this.mFragments = fragmentList;
    }


    @Override
    public int getCount() {
        return mFragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {

        return mList.get(position);
    }




    @Override
    public Fragment getItem(int position) {
        if (position < mList.size()) {
            return mFragments.get(position);
        }
        return null;
    }
}


